<template>
  <div>
    <!-- 添加或修改信息咨询对话框 -->
    <el-dialog  center :visible.sync="open" width="800" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">

        <div style="font-size: 20px;font-weight: 500;text-align: center;margin-top: -20px;margin-bottom: 20px;">{{form.title}}</div>
        <hr/>
        <el-form-item label="资讯发布" class="item">
           <span> {{form.createTime}}</span>
           <span style="margin-left: 20px;">{{form.createBy+'创建'}}</span>
        </el-form-item>
        <el-row>
          <el-col :span="10">
        <el-form-item label="咨询名称" class="item">
          {{form.title}}
        </el-form-item>
        </el-col>
        <el-col :span="10">
            <el-form-item label="咨询状态" class="item">
                {{this.selectDictLabel(this.statusOptOptions, form.statusOpt)}}
              </el-form-item>
            </el-col>
        </el-row>
        <el-form-item label="咨询栏目" class="item">
              {{form.subjectName}}
        </el-form-item>
        <el-form-item label="咨询附件" class="item">
          <UploadCom ref="upload" :userFileList="fileList" disabled/>
        </el-form-item>
        <el-form-item label="咨询内容" class="item">
          <div v-html="form.content"></div>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { getContent } from "@/api/consultation/content";
import UploadCom from "@/views/labdata/commons/upload.vue";
export default {
  name: "ConsultDetail",
  components: {UploadCom },
  data() {
    return {
      //附件集合
      fileList: [],
      // 是否显示弹出层
      open: false,
      // 咨询状态字典
      statusOptOptions: [],
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  props:{
    title:String,
  },
  created() {
    this.getDicts("consultationStatusOpt").then(response => {
      this.statusOptOptions = response.data;
    });
  },
  methods: {
    // 取消按钮
    cancel() {
      this.fileList = [];
      this.open = false;
    },
    /** 修改按钮操作 */
    openDetail(id) {
      getContent(id).then(response => {
        this.form = response.data;
        this.fileList = this.form.images;
        this.open = true;
      });
    },
  }
};
</script>
<style type="text/css" scoped>
 /deep/ .el-upload {
    display: none !important;
  }
  /deep/ .el-form-item--medium .el-form-item__content{
    width:600px;
  }
  .item {
    margin-bottom: 2px;
  }
</style>
